package com.serverTechnology.teamsGroups.entity.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 设备树
 *
 * @Author 王烁烁
 * @Date 2024/7/31
 */
@Data
public class DeviceTreeVo {

    @ApiModelProperty("设备类型id")
    private Long id;

    @ApiModelProperty("设备大类、工具大类、设备大类")
    @TableField("DEVICE_CATEGORY")
    private String dictName;

    @ApiModelProperty("编码")
    private String deviceNumber;

    @ApiModelProperty("是否被勾选 true 是，false 否")
    private Boolean checked;

    @ApiModelProperty("设备类型")
    private List<DeviceTypeTreeVo> deviceTypeTreeVos = new ArrayList<>();

    @Data
    public static class DeviceTypeTreeVo {

        @ApiModelProperty(value = "设备类型表主键id")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long id;

        @ApiModelProperty(value = "设备类型名称、工具类型名称、工装类型名称")
        private String deviceName;

        @ApiModelProperty("编码")
        private String code;

        @ApiModelProperty("是否被勾选 true 是，false 否")
        private Boolean checked;

        @ApiModelProperty("设备")
        private List<EquipmentTreeVo> equipmentTreeVos = new ArrayList<>(); // 初始化集合

        @Data
        public static class EquipmentTreeVo {

            @TableId(value = "ID", type = IdType.ASSIGN_ID)
            @ApiModelProperty(value = "唯一标识")
            @JsonSerialize(using = ToStringSerializer.class)
            private Long id;

            @ApiModelProperty(value = "设备编号、工具编号、工装编号")
            @JsonSerialize(using = ToStringSerializer.class)
            private String resourceNumber;

            @ApiModelProperty(value = "设备名称、工具名称、工装名称")
            private String resourceName;

            @ApiModelProperty(value = "规格")
            private String resourceSpecification;

            @ApiModelProperty("是否被勾选 true 是，false 否")
            private Boolean checked;
        }
    }
}
